<table class="data" width="100%">
  <tr>
    <th>ID</th>
    <th></th>
    <th></th>
    <th><?php echo CHtml::activeLabelEx($model,'title'); ?></th>
    <th><?php echo CHtml::activeLabelEx($model,'alias'); ?></th>
    <th><?php echo CHtml::activeLabelEx($model,'url'); ?></th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
    <th>&nbsp;</th>
  </tr>
<?php foreach($tree as $n=>$node): ?>
  <?php
  $moveLeft_link = CHtml::link('▲', array('parts/moveLeft', 'id'=>$node->id), array('class'=>'no-decoration'));
  $moveRight_link = CHtml::link('▼', array('parts/moveRight', 'id'=>$node->id), array('class'=>'no-decoration'));
  $add_link = CHtml::link(CHtml::image($this->assets.'/images/insert.png', 'Добавить раздел'), array('parts/add', 'id'=>$node->id));
  $edit_link = CHtml::link(CHtml::image($this->assets.'/images/update.png', 'Редактировать раздел'), array('parts/update', 'id'=>$node->id));
  $delete_link = '';
  if($node->id > 1)
	  $delete_link = CHtml::link(CHtml::image($this->assets.'/images/delete.png', 'Удалить раздел'), array('parts/delete', 'id'=>$node->id), array(
	  	'onclick' => 'return confirm("Вы уверены что хотите удалить этот раздел со всеми подразделами?");'
	  ));
  ?>
  <tr class="<?php echo $n%2?'even':'odd';?>">
  	<td><?php echo $node->id; ?>.</td>
  	<td align='center'><?php echo $moveLeft_link; ?></td>
  	<td align='center'><?php echo $moveRight_link; ?></td>
    <td><pre class='normal'><?php echo str_repeat('    ', $node->level).CHtml::encode(CString::truncateByWords($node->title, 2)); ?></pre></td>
    <td><?php echo CHtml::encode($node->alias); ?></td>
    <td><?php echo $node->url!=''?CHtml::link( eval('return Yii::app()->createUrl('.$node->url.');'), eval('return Yii::app()->createUrl('.$node->url.');')):''; ?></td>
    <td align='center'><?php echo $add_link; ?></td>
    <td align='center'><?php echo $edit_link; ?></td>
    <td align='center'><?php echo $delete_link; ?></td>
  </tr>
<?php endforeach; ?>
</table>